//
//  WJQUserLoginViewController.m
//  TripTogether
//
//  Created by dllo on 15/12/31.
//  Copyright © 2015年 王军岐. All rights reserved.
//

#import "WJQUserLoginViewController.h"
#import "WJQPhoneLoginViewController.h"
#import "WJQUserRegisterViewController.h"
#import "WJQForgotpassViewController.h"

@interface WJQUserLoginViewController ()
@property (nonatomic,strong)UILabel *namefield;
@property (nonatomic,strong)UIButton *signBtn;
@property (nonatomic,strong)UIButton *sagnBtn;
@property (nonatomic,strong)UIView *viewLine;
@end

@implementation WJQUserLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor colorWithRed:0.320 green:0.740 blue:0.800 alpha:1.000];
    
    
    [self createView];
    
    
    [self createBackButton];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeView) name:@"loginClose" object:nil];
}

- (void)closeView
{

    [self dismissViewControllerAnimated:YES completion:^{

    }];

}
- (void)createView{
    _namefield = [UILabel new];
    [self.view addSubview:_namefield];
    _namefield.text = @"你好，游粉!";
    
    _namefield.textColor = [UIColor whiteColor];
    _namefield.font = [UIFont fontWithName:@"Bangla Sangam MN" size:40];
   // _namefield.backgroundColor = [UIColor redColor];
    [_namefield mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(150*AUTO_HEIGHT);
        make.centerX.mas_equalTo(@0);
        make.height.mas_equalTo(100* AUTO_HEIGHT);
       
    }];
    

    
    
    
    
    UILabel *laText = [UILabel new];
    [self.view addSubview:laText];
    laText.text = @"使用账号登入";
    laText.font = [UIFont fontWithName:@"Lao Sangam MN" size:15];
    laText.textColor = [UIColor colorWithWhite:1.000 alpha:0.760];
    [laText mas_makeConstraints:^(MASConstraintMaker *make) {
       // make.left.mas_equalTo(_viewLine.mas_right).offset(20 * AUTO_WIDTH);
        make.height.mas_equalTo(20 * AUTO_HEIGHT);
        make.centerX.mas_equalTo(@0);
        make.top.mas_equalTo(_namefield.mas_bottom).mas_equalTo(40 * AUTO_HEIGHT);
        
    }];
    
    
    
//    
    _viewLine = [UIView new];
    _viewLine.backgroundColor = [UIColor colorWithRed:0.960 green:0.914 blue:1.000 alpha:1.000];
    [self.view addSubview:_viewLine];
    
    [_viewLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(40 * AUTO_WIDTH);
        make.top.mas_equalTo(_namefield.mas_bottom).mas_equalTo(50 * AUTO_HEIGHT);
        make.right.mas_equalTo(laText.mas_left).offset(-10);
        make.height.mas_equalTo(1 * AUTO_HEIGHT);
        
    }];

    
    
    UIView *viline = [UIView new];
    viline.backgroundColor = [UIColor colorWithRed:0.960 green:0.914 blue:1.000 alpha:1.000];
    [self.view addSubview:viline];
    
    [viline mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(laText.mas_right).offset(10 * AUTO_WIDTH);
        make.top.mas_equalTo(_namefield.mas_bottom).mas_equalTo(50 * AUTO_HEIGHT);
        make.right.mas_equalTo(self.view).offset(-30 * AUTO_WIDTH);
        make.height.mas_equalTo(1 * AUTO_HEIGHT);
        
    }];

    
    
    
    _signBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:_signBtn];
    [_signBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_namefield.mas_bottom).mas_equalTo(110 * AUTO_HEIGHT);
        make.left.mas_equalTo(40 *AUTO_WIDTH);
        make.right.mas_equalTo(self.view).offset(-40 * AUTO_WIDTH);
        make.height.mas_equalTo(50 * AUTO_HEIGHT);
        
    }];
    
    
    
    
    [_signBtn.layer setMasksToBounds:YES];
    [_signBtn.layer setCornerRadius:25.0 * AUTO_HEIGHT]; //设置矩形四个圆角半径
    [_signBtn.layer setBorderWidth:2.0 * AUTO_WIDTH]; //边框宽度
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
   CGColorRef colorref = CGColorCreate(colorSpace,(CGFloat[]){ 0, 0, 0, 0 });
    
   [_signBtn.layer setBorderColor:colorref];//边框颜色
//    [_signBtn.layer setBackgroundColor:(__bridge CGColorRef _Nullable)([UIColor colorWithRed:0.960 green:0.914 blue:1.000 alpha:1.000])];
      [_signBtn setTitle:@"通过手机号登入" forState:UIControlStateNormal];//button title
    
    [_signBtn setTitleColor:[UIColor colorWithRed:0.320 green:0.740 blue:0.800 alpha:1.000] forState:UIControlStateNormal];//title color
    
    [_signBtn addTarget:self action:@selector(buttonDonwRecover:) forControlEvents:UIControlEventTouchUpInside];//button 点击回调方法
    
    _signBtn.backgroundColor = [UIColor whiteColor];
    
    
    
    
    
    _sagnBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:_sagnBtn];
    [_sagnBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_signBtn.mas_bottom).mas_equalTo(20 * AUTO_HEIGHT);
        make.left.mas_equalTo(40 * AUTO_WIDTH);
        make.right.mas_equalTo(self.view).offset(-40 * AUTO_WIDTH);
        make.height.mas_equalTo(50 * AUTO_HEIGHT);
        
    }];
    [_sagnBtn.layer setMasksToBounds:YES];
    [_sagnBtn.layer setCornerRadius:25.0  * AUTO_HEIGHT]; //设置矩形四个圆角半径
    [_sagnBtn.layer setBorderWidth:2.0 * AUTO_WIDTH]; //边框宽度
    CGColorSpaceRef colorSpac = CGColorSpaceCreateDeviceRGB();
    CGColorRef colorre = CGColorCreate(colorSpac,(CGFloat[]){ 1, 1, 1, 1});
    
    [_sagnBtn.layer setBorderColor:colorre];//边框颜色
    
    [_sagnBtn setTitle:@"通过游者用户名登入" forState:UIControlStateNormal];//button title
    
    [_sagnBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];//title color
    
    [_sagnBtn addTarget:self action:@selector(sagnBtn:) forControlEvents:UIControlEventTouchUpInside];//button 点击回调方法
    
    _sagnBtn.backgroundColor = [UIColor colorWithRed:0.320 green:0.740 blue:0.800 alpha:1.000];

    
    
    
    
    UIView *lin = [UIView new];
    lin.backgroundColor = [UIColor colorWithRed:0.960 green:0.914 blue:1.000 alpha:1.000];
    [self.view addSubview:lin];
    
    [lin mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view);
        make.top.mas_equalTo(self.view.mas_bottom).offset(-60 * AUTO_HEIGHT);
        make.width.mas_equalTo(self.view);
        make.height.mas_equalTo(1 * AUTO_HEIGHT);
        
    }];
    
    
    UIView *center = [UIView new];
    center.backgroundColor = [UIColor colorWithRed:0.960 green:0.914 blue:1.000 alpha:1.000];
    [self.view addSubview:center];
    
    [center mas_makeConstraints:^(MASConstraintMaker *make) {
       make.top.mas_equalTo(self.view.mas_bottom).offset(-60 * AUTO_HEIGHT);
        make.left.mas_equalTo(self.view.mas_centerX).offset(-1 * AUTO_WIDTH);
        make.height.mas_equalTo(50 * AUTO_HEIGHT);
        make.width.mas_equalTo(1 * AUTO_WIDTH);
        
    }];
    
    
    
    UIButton *butForgentPass = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:butForgentPass];
    [butForgentPass addTarget:self action:@selector(button) forControlEvents:UIControlEventTouchUpInside];
    [butForgentPass setTitle:@"忘记密码" forState:UIControlStateNormal];
    butForgentPass.titleLabel.font = [UIFont fontWithName:@"Lao Sangam MN" size:15];
    [butForgentPass mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view);
        make.height.mas_equalTo(50 * AUTO_HEIGHT);
        make.width.mas_equalTo(180 * AUTO_WIDTH);
         make.top.mas_equalTo(self.view.mas_bottom).offset(-55 * AUTO_HEIGHT);
        
    }];
    
    
    
    UIButton *butRegisPass = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:butRegisPass];
    [butRegisPass addTarget:self action:@selector(butReg) forControlEvents:UIControlEventTouchUpInside];
    [butRegisPass setTitle:@"注册账号" forState:UIControlStateNormal];
    butRegisPass.titleLabel.font = [UIFont fontWithName:@"Lao Sangam MN" size:15];
    [butRegisPass mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view.mas_centerX);
        make.height.mas_equalTo(50 * AUTO_HEIGHT);
        make.width.mas_equalTo(180 * AUTO_WIDTH);
        make.top.mas_equalTo(self.view.mas_bottom).offset(-55 * AUTO_HEIGHT);
        
    }];

    
    
    
    
}



-(void)buttonDonwRecover:(UIButton *)btu{

    WJQPhoneLoginViewController *phoneVC = [[WJQPhoneLoginViewController alloc] init];
    phoneVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentViewController:phoneVC animated:YES completion:^{
        
        
    }];

}


- (void)sagnBtn:(UIButton *)btu{
    
    WJQPhoneLoginViewController *phoneVC = [[WJQPhoneLoginViewController alloc] init];
    phoneVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [self presentViewController:phoneVC animated:YES completion:^{
        
        
    }];


}
- (void)button{
   
    WJQForgotpassViewController *forgotPassVC = [[WJQForgotpassViewController alloc] init];
    [self presentViewController:forgotPassVC animated:YES completion:^{
        
        
    }];
}
- (void)butReg{
    
    WJQUserRegisterViewController *registerVC = [[WJQUserRegisterViewController alloc] init];
    [self presentViewController:registerVC animated:YES completion:^{
        
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
